package com.googlecode.classgrep.info;

import java.util.ArrayList;
import java.util.List;


public class ClassInfo extends Annotatable implements Info {
    private final String name;
    private final List<MethodInfo> methods = new ArrayList<MethodInfo>();
    private final List<MethodInfo> constructors = new ArrayList<MethodInfo>();
    private final String superType;
    private final List<String> interfaces = new ArrayList<String>();
    private final List<String> superInterfaces = new ArrayList<String>();
    private final List<FieldInfo> fields = new ArrayList<FieldInfo>();


    public ClassInfo(String name, String superType) {
        this.name = name;
        this.superType = superType;
    }

    public String getPackageName(){
        return name.indexOf(".") > 0 ? name.substring(0, name.lastIndexOf(".")) : "" ;
    }

    public List<MethodInfo> getConstructors() {
        return constructors;
    }

    public List<String> getInterfaces() {
        return interfaces;
    }

    public List<String> getSuperInterfaces() {
        return superInterfaces;
    }

    public List<FieldInfo> getFields() {
        return fields;
    }

    public List<MethodInfo> getMethods() {
        return methods;
    }

    public String getName() {
        return name;
    }

    public String getSuperType() {
        return superType;
    }

    @Override
    public String toString() {
        return name;
    }
}